//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "UI/Types/UITexture.h"

namespace Engine
{
namespace UI
{


	//
	// UI Texture Manager
	//

	class UITextureManager : public BaseObject
	{
	// types
	private:


	// variables
	private:

		// TODO: add atlas

	// methods
	public:
		UITextureManager (const EngineSubSystemsRef ess);
		~UITextureManager ();

		bool Load (UITexture &tex, uni_c_string name);
	};



	// constructor
	inline UITextureManager::UITextureManager (const EngineSubSystemsRef ess) :
		BaseObject(ess)
	{
	}

	// destructor
	inline UITextureManager::~UITextureManager ()
	{
	}

	// Load
	inline bool UITextureManager::Load (UITexture &tex, uni_c_string name)
	{
		Graphics::Texture::TexLoadParams	params;

		params.generateMipmaps	= true;
		params.sampler			= Graphics::Sampler::Default3D();

		CHECK_ERR( ESS()->GetResourceManager()->Load( EResource::TEXTURE, 
						name, tex._texture ) );

		tex._texcoord = rect( 0.0f, 0.0f, 1.0f, 1.0f );
		tex._inAtlas  = false;
		tex._dim	  = tex._texture->Dimension().xy();
		return true;
	}

}	// UI
}	// Engine